package com.caac.core.config;

import java.io.Serializable;

import com.caac.core.Global;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright caac 2006</p>
 * <p>Company: caac</p>
 * @author <a href="mailto:project@caac.com.cn">Project Group</a>
 * @version 1.0
 */

public class ActionConf implements Serializable {
    private String key;
    private String title;
    private boolean authorized;
    private boolean isRoot;
    private boolean isBranch;
    private boolean isLeaf;
    private boolean administrable;

    public ActionConf(String key, String domain, String title,
                      boolean authorized, boolean administrable) {
        this.key = key;
        this.title = title;
        this.authorized = authorized;
        this.administrable = administrable;
        if (domain.indexOf(Global.KEY_DOMAIN_ROOT) != -1) {
            this.isRoot = true;
        }
        if (domain.indexOf(Global.KEY_DOMAIN_BRANCH) != -1) {
            this.isBranch = true;
        }
        if (domain.indexOf(Global.KEY_DOMAIN_LEAF) != -1) {
            this.isLeaf = true;
        }
    }

    public String getKey() {
        return key;
    }

    public String getTitle() {
        return title;
    }

    public boolean isAuthorized() {
        return authorized;
    }

    public boolean isAdministrable() {
        return administrable;
    }

    public boolean isRoot() {
        return isRoot;
    }

    public boolean isBranch() {
        return isBranch;
    }

    public boolean isLeaf() {
        return isLeaf;
    }
}
